<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width" />
    <title>菜鸟教程</title>
  </head>
  <body>
    <script type="text/javascript">
      function foo() {
        var a = (b = 100);
      }

      foo();

      console.log(window.b);
      console.log(b);

      console.log(window.a);
      console.log(a);
    </script>
  </body>
</html>
